
class Fat12(object):
    def __init__(self, name: str):
        self.__ptr = vfs.fat12_alloc(name)

    def __del__(self):
        vfs.fat12_free(self.__ptr)

    def ptr(self):
        self.__ptr

    def name(self):
        self.fat12_get_name(self.__ptr)

import unittest 

class TestFat12(unittest.TestCase):
    def test_main(self):
        fat12 = Fat12("fat12")
        self.assertTrue(fat12.ptr() != 0)
        self.assertEqual("fat12", fat12.name())

    def test_used_in_fs(self):
        fat12 = Fat12("fat12")
        kernel.register_filesystem(fat12)
        kernel.unregister_filesystem(fat12)

class FileSystemType(object):
    def __init__(self, name: str):
        pass

    def getName(self) -> str:
        pass

    def node(self) -> object:
        pass
    
    def print(self):
        pass



class Kernel(object):
    def __init__(self):
        pass

    def register_filesystem(self, fs_type: FileSystemType) -> int:
        return vfs.register_filesystem(fs_type)
    def unregister_filesystem(self, fs_type: FileSystemType) -> int:
        return vfs.unregister_filesystem(fs_type)
    def find_filesystem(self, name:str) -> object:
        return vfs.find_filesystem(name)

    
import unittest 

class TestFileSystemType(unittest.TestCase):
    def test_main(self):
        kernel = Kernel()
        fat12 = Fat12()
        kernel.register_filesystem(fat12)
        pfat12  = kernel.find_filesystem(fat12.getName())
        kernel.unregister_filesystem(fat12)


class TestKernel(unittest.TestCase):
    def test_main(self):
        pass
        #kernel.syscall().mount("/dev/sda1", "/mnt", fs_type, 0, "ro");
        #kernel.syscall().umount("/mnt", 0);


#TODO:
class Pointer(object):
    pass
class PPointer(object):
    pass


#   self.__syscall = SystemCall(self)
#def syscall(self):
#    return self.__syscall
class SystemCall(object):
    def __init__(self, kernel: object):
        self.__kernel = kernel

    def kernel(self):
        return self.__kernel

    def mount(self, dev: str, mount_point: str, fs_type: str, flags: int, data: str):
        self.__kernel.find_filesystem("vfat")
        pass

    def umount(self, mount_point: str, flags: int):
        pass
